<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="溯源码" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="产生日期" prop="FBILLCREDATE">
            <el-input v-model="dataForm.FBILLCREDATE"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="批次码"" prop="FBATCH">
            <el-input v-model="dataForm.FBATCH"   />
          </el-form-item>
        </el-col>

          <el-col :span="8">
          <el-form-item label="菜品编号"" prop="FITEMNO">
            <el-input v-model="dataForm.FITEMNO"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="菜品名称"" prop="FITEMNAME">
            <el-input v-model="dataForm.FITEMNAME"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="菜品规格"" prop="FSPEC">
            <el-input v-model="dataForm.FSPEC"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="单位"" prop="FUNIT">
            <el-input v-model="dataForm.FUNIT"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="食堂名称"" prop="FCATNAME">
            <el-input v-model="dataForm.FCATNAME"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="餐别"" prop="FCATTYPE">
            <el-input v-model="dataForm.FCATTYPE"   />
          </el-form-item>
        </el-col>

        
        <el-col :span="5">
          <el-form-item label="">
            <!-- <el-button type="success" icon="el-icon-plus" @click="insert">添加场地</el-button> -->
            <el-button type="primary" :loading="loading" @click="closePage">返回</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>

    <template>
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="溯源码明细" name="second">
        <el-table :data="list1" border stripe>
          <el-table-column prop="FENTRYID"FDATE label="序号" width="85" ></el-table-column>
          <el-table-column prop="FTYPE" label="业务别"  ></el-table-column>
          <el-table-column prop="FTIME" label="时间"   ></el-table-column>
          <el-table-column prop="FUSER" label="人员"  ></el-table-column>
          <el-table-column prop="FSUPNAME" label="供应商"   ></el-table-column>
          <el-table-column prop="FQTY" label="数量"   ></el-table-column>
          <el-table-column prop="FMEMO" label="备注"></el-table-column>
       </el-table>
      </el-tab-pane>

      <el-tab-pane label="食材明细" name="four">
        <el-table :data="list2" border stripe>
          <el-table-column prop="FENTRYID"FDATE label="序号" width="85" ></el-table-column>
          <el-table-column prop="FITEMNO" label="食材编号"  ></el-table-column>
          <el-table-column prop="FITEMNAME" label="食材名称"   ></el-table-column>
          <el-table-column prop="FBILLNO" label="溯源码"  ></el-table-column>
          <el-table-column prop="FQTY" label="用量"   ></el-table-column>
          <el-table-column prop="FMEMO" label="备注"></el-table-column>
       </el-table>
      </el-tab-pane>

    </el-tabs>
    
   </template>

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        activeName: 'second',

        title: "新增",
        insertorupdate: true,
        dataForm: {
            FBILLNO: "30000120251130100002009", 
            FBILLCREDATE:"2025-11-30 06:31:09",
            FSUPNAME: "萧山银龙农业发展有限公司",
            FITEMNO:"100002",
            FITEMNAME: "美味肉排",
            FSPEC:"500g",
            FUNIT: "公斤",
            FCATNAME: "大食堂",
            FCATTYPE: "午餐",
            FNOTE:""
        },
        rules: {
          FUSERNUMBER:[
            { required: true, message: '请输入学籍号码', trigger: 'blur' },
          ],
          FUSER: [
            { required: true, message: '请输入申请人员', trigger: 'blur' },
          ],
          FMEMO: [
            { required: true, message: '请输入申请理由', trigger: 'blur' },
          ],
        },
        list1: [{ "FENTRYID":1,
                  "FTYPE": "入库",
                  "FTIME":"2025-11-30 06:31:09",
                  "FUSER":"",
                  "FSUPNAME":"",
                  "FQTY":500,
                  "FMEMO": ""
                },
                { "FENTRYID":2,
                  "FTYPE": "领用",
                  "FTIME":"2025-11-30 08:31:09",
                  "FUSER":"",
                  "FSUPNAME":"",
                  "FQTY":500,
                  "FMEMO": ""
                },
                { "FENTRYID":3,
                  "FTYPE": "留样",
                  "FTIME":"2025-11-30 08:35:09",
                  "FUSER":"",
                  "FSUPNAME":"",
                  "FQTY":500,
                  "FMEMO": ""
                }],
                
        list2: [{  "FENTRYID":1,
                    "FITEMNO":"100001",
                    "FITEMNAME": "大白菜",
                    "FBILLNO":"30000120251130100001009",
                    "FQTY":"500g",
                    "FMEMO": ""
                  },
                  { "FENTRYID":2,
                    "FITEMNO":"200001",
                    "FITEMNAME": "肉排",
                    "FBILLNO":"30000120251130200001009",
                    "FQTY":"500g",
                    "FMEMO": "自检"
                  }],
        
        loading: false,
        visible: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '新机构'
        }, {
          value: '2',
          label: '改机构'
        }, {
          value: '3',
          label: '老机构'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      closePage(){
        console.log('关闭弹窗dialog');
        this.visible = false;
      },
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "修改"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shopdate(id) {
        let link = document.createElement('a');
        link.href = 'http://180.166.193.6:90/images/study/acc-01.png';
        link.target = '_blank'; // 在新窗口或新标签页中打开URL
        link.click();
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>